import { setupBase } from './base'
import { setupWaypoint } from './waypoint'
import { setupATSRoute } from './atsroute'
import { setupAirport } from './airport'
import { setupRouting } from './routing'
import { setupAircraftType } from './aircraft-type'
import { setupAircraft } from './aircraft'
import { setupFlightPlan } from './flightplan'
import { setupTable } from './table'
import type { LoadingScreenInstance } from '@/widgets'

export {
  entityTypeList,
  getEntityType,
  getEntity,
  getEntityIdList,
  getEntityList,
  getEntityMap
} from './base'

export {
  selectEntity,
  showEntityTable,
  showEntityTablePartial,
  selectAndShowEntityTable,
  selectEntityType,
  selectEntityByType,
  selectEntityIdByType,
  selectEntityTypeId
} from './table'
export * from './waypoint'
export * from './atsroute'
export * from './airport'
export * from './routing'
export * from './aircraft-type'
export * from './aircraft'
export * from './flightplan'

export async function setup(ls?: LoadingScreenInstance) {
  setupBase()
  setupTable()
  ls?.updateMessage('正在加载航路点...')
  await setupWaypoint()
  ls?.updateMessage('正在加载航路...')
  await setupATSRoute()
  ls?.updateMessage('正在加载机场...')
  await setupAirport()
  ls?.updateMessage('正在加载飞行路线...')
  await setupRouting()
  ls?.updateMessage('正在加载机型数据...')
  await setupAircraftType()
  ls?.updateMessage('正在加载飞机...')
  await setupAircraft()
  ls?.updateMessage('正在加载飞行计划...')
  await setupFlightPlan()
}
